package edu.jiefengli.course_selection_system.mapper;

import edu.jiefengli.course_selection_system.pojo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from user where account=#{account}")
    User getUserByAccount(String account);

    @Select("select * from user")
    List<User> getAllUsers();

    @Select("select * from user where id=#{id}")
    User getUserById(int id);

    @Insert("insert into user(account,password,name,role) values(#{account},#{password},#{name},#{role})")
    void addUser(User user);

}
